﻿using System;
using App.Entity;
using App.IServices;
using App.IRepository;
using System.Collections.Generic;
using App.Code;

/*!
* 文件描述：一切从简，只为了更懒！
*/
namespace App.Services
{
	public partial class articleServices : BaseServices<article> , IarticleServices
	{
		IarticleRepository _IarticleRepository;
		public articleServices(IarticleRepository __IarticleRepository)
		{
			this._IarticleRepository = __IarticleRepository;
			base._IBaseRepository = __IarticleRepository;
		}

        public List<article> GetList(string articleid = "", string keyWord = "")
        {
            var expression = ExtLinq.True<article>();
            if (!string.IsNullOrEmpty(articleid))
            {
                expression = expression.And(t => t.ArticleId == articleid);
            }
            if (!string.IsNullOrEmpty(keyWord))
            {
                expression = expression.And(t => t.ArticleTitle.Contains(keyWord));
            }
            return _IarticleRepository.QueryByWhere(expression, "ViewCount");
        }
    }
}